package Z.dailyExercise._0225;

public class _剑指Offer18删除链表的节点 {
    public ListNode deleteNode(ListNode head, int val) {
        if (head == null){
            return head;
        }
        if (head.val == val){
            return head.next;
        }
        ListNode temp = head;
        while (temp.next!= null){
            if (temp.next.val == val){
                temp.next = temp.next.next;
                return head;
            }
            temp = temp.next;
        }
        return head;

    }
}
